<%@ page language="java" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<%@ include file="/commons/jsp/taglibs.jsp"%>
<%@taglib uri="http://www.framework.com/taglib" prefix="frame"%>
 <HEAD>
<TITLE>weboffice展示</TITLE>
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="${ctx}/word_plugin/style.css"></link>
<link href="${ctx}/commons/css/style.css" rel="stylesheet" type="text/css"/>
	<link rel="stylesheet" type="text/css" href="${ctx}/commons/themes/default/easyui.css">
	<link rel="stylesheet" type="text/css" href="${ctx}/commons/themes/icon.css">
	
<script type="text/javascript" src="${ctx}/commons/js/jquery-1.8.0.min.js"></script>
<script src="${ctx}/word_plugin/main.js" type="text/javascript"></script>
	<!-- 样式文件的引入 -->
	
	<!-- jqueryUI JS文件的引入 -->
	<script type="text/javascript" src="${ctx}/commons/js/jquery-1.8.0.min.js"></script>

	<script type="text/javascript" src="${ctx}/commons/js/jquery.easyui.min.js"></script>
	<script type="text/javascript" src="${ctx}/commons/js/easyui-extends-validate.js"></script>
	<!-- jqueryUI国际化 -->
	<script type="text/javascript" src="${ctx}/commons/js/easyui-lang-zh_CN.js"></script>
	<!-- 开发使用的公用js方法 -->
<%-- 	<script type="text/javascript" src="${ctx}/commons/js/common.js"></script>
    --%>
    <script language="JavaScript">
        $(document).ready(function () {
        	//alert('dfdsf');
        	var _url="${urlStr}";
        	if (_url==""){
        		// $("#west").style.width = 1 + 'px';
        	}else{
        		$( "#west" ).load( "${urlStr}",
                        function( response, status, xhr ) {
                      $('#west').html(response);
                 });
        	}
        	
        	//加载frame
        	open2Tab("",'${ctx}','${resId}');
        });
    </script>
    <style>
        .footer {
            width: 100%;
            text-align: center;
            line-height: 35px;
        }
 
        .top-bg {
            background-color: #d8e4fe;
            height: 80px;
        }
 
    </style>
</head>
 
<body class="easyui-layout">
    <div region="south" border="true" split="true" style="overflow: hidden; height: 25px;">
      <!--   <div class="footer"><a href="javascript:windows.close();">关闭</a></div> -->
    </div>
    <div region="west" split="true" title="目录查看" style="width:<c:choose><c:when test="${urlStr==''}">0px</c:when>
                                                                <c:otherwise>45%</c:otherwise></c:choose>;" id="west">
    <!-- begin west -->
    <!-- end west -->
    </div>
    <div id="t" region="center" style="overflow: hidden;">
      <iframe id="theone" src="" width="100%" height="100%"></iframe>   
    </div>
</body>
</html>
<script language="javascript">

function addTab(title, url){
	if ($('#tabs').tabs('exists', title)){
		$('#tabs').tabs('select', title);
	} else {
		var content = '<iframe scrolling="auto" frameborder="0"  src="'+url+'" style="width:100%;height:100%;"></iframe>';
		$('#tabs').tabs('add',{
			title:title,
			content:content,
			closable:true
		});
	}
}

function showOpenFile(ctx,resId){
	var url= ctx+"/office/plugin/detail?resId="+resId;
	//addTab(subtitle,url);
	$("#theone").attr("src",url); 
}

function open2Tab(subtitle,ctx,resId){
	//组织word插件
    var url= ctx+"/office/plugin/detail?resId="+resId;
	//addTab(subtitle,url);
	$("#theone").attr("src",url);  
}

function addTab2(subtitle, url) {
    if (!$('#tabs').tabs('exists', subtitle)) {
        $('#tabs').tabs('add', {
            title: subtitle,
            content: createFrame(url),
            closable: true,
            width: $('#mainPanle').width() - 10,
            height: $('#mainPanle').height() - 26
        });
    } else {
        $('#tabs').tabs('select', subtitle);
   }
    tabClose();
}

  function createFrame(url) {
      var s = '<iframe name="mainFrame" scrolling="auto" frameborder="0"  src="' + url + '" style="width:100%;height:100%;"></iframe>';
      return s;
  }

</script>